<?php
require_once '../Model/Level/OPPowerBar.php';

class InitialPowerBarTest extends PHPUnit_Framework_TestCase {
	
	public function setUp() {
		$this->powerBar = OPPowerBar::newWithGoalAndNumberOfLevels(100, 5);
		
	}
	
	/**
	 * @test
	 */
	public function maxShouldReturn100() {
		$this->assertEquals(100, $this->powerBar->goal());
		
	}
	
	/**
	 * @test
	 */
	public function numberOfLevelsShouldReturn5() {
		$this->assertEquals(5, $this->powerBar->numberOfLevels());
		
	}
	
	/**
	 * @test
	 */
	public function levelShouldBe1() {
		$this->assertEquals(1, $this->powerBar->level());
		
	}
	
	/**
	 * @test
	 */
	public function goalToNextLevelShouldBe20() {
		$this->assertEquals(20, $this->powerBar->goalToNextLevel());
		
	}
	
	/**
	* @test
	*/
	public function scoreShouldBe0() {
		$this->assertEquals(0, $this->powerBar->score());
		
	}
	
	/**
	 * @test
	 */
	public function scoreShouldBe5After5PointsWinning() {
		$this->powerBar->increaseBy(5);
		
		$this->assertEquals(5, $this->powerBar->score());
		
	}
	
	/**
	* @test
	*/
	public function scoreShouldBe3After5PointsWinningThen2PointLoosing() {
		$this->powerBar->increaseBy(5);
		$this->powerBar->decreaseBy(2);
	
		$this->assertEquals(3, $this->powerBar->score());
	
	}
	
	/**
	* @test
	*/
	public function scoreShouldBe0After5PointsLoosing() {
		$this->powerBar->decreaseBy(5);
	
		$this->assertEquals(0, $this->powerBar->score());
	
	}
	
	
}